<?php
/**
 * Created by PhpStorm.
 * User: W
 * Date: 2018/2/24
 * Time: 16:57
 */

namespace app\console\controller;

use app\common\controller\Console;

class Order extends Console {

    public function _empty()
    {
        return $this->fetch();
    }

    public function index()
    {
        $where = [];
        $model = model('Orders');
        $list = $model
            ->alias('a')
            ->field('a.*,b.address,b.realname,b.mobile')
            ->join('address b','a.address_id=b.id','left')
            ->where($where)
            ->paginate(10, false, ['query'=>request()->param()]);
        $this->assign('list', $list);
        return $this->fetch();
    }

    public function detail($id)
    {
        $res = model('OrderDetails')->where('order_id', $id)->select();
        $this->assign('list', $res);
        return $this->fetch();
    }
}
